<?php include PATH_TPL."/tpl_header.html" ?>
<script type="text/javascript">
	$(function(){
		var course_id  = $("#course_id").val();
		var adminUrl  = '/index.php/admin/';
		
		$("#grade-menu").addClass('in');
		$('#downLoadBtn').click(function(){
			location.href = adminUrl+"downLoadGrade/id/"+course_id; 
		})
	})
</script>

<div class="header">
    <h1 class="page-title">成绩管理</h1>
</div>
        
<ul class="breadcrumb">
    <li><a href="<?php echo SITE_ROOT?>admin/show-classes">成绩管理</a> <span class="divider">/</span></li>
    <li><a href="<?php echo SITE_ROOT?>admin/show-active-courses">所有科目</a> <span class="divider">/</span></li>
    <li class="active"><?php echo $course['coursename']?>的期末成绩</li>
</ul>

<div class="container-fluid">
    <div class="row-fluid">
		<div class="btn-toolbar">
		   	<span class="btn"><?php echo $term[$course['term']]?></span>
		    <button class="btn" id="downLoadBtn">导出</button>
		</div>
		<div class="well">
			<input type="hidden" value="<?php echo $course['course_id'] ?>" id="course_id">
		    <table class="table">
		    	<?php if (!empty($allGrades)) {?>
		      <thead>
		        <tr>
		          <th>学号</th>
		          <th>姓名</th>
		          <th>成绩</th>
		          <th>名次</th>
		        </tr>
		      </thead>
		      <tbody>
		      	<?php foreach ($allGrades as $k => $grade) { ?>
		        <tr>
		          <td><?php echo $grade['student_id'] ?></td>
		          <td><?php echo $allStudent[$grade['student_id']]['name']?></td>
		          <td><?php echo $grade['score']?></td>
		          <td>
		              <?php echo $k+1 ;?>
		          </td>
		        </tr>
		        <?php }?>
		      </tbody>
		      <?php }else{?>
		      <tr><td>暂无成绩信息</td></tr>
		      <?php }?>
		    </table>
		</div>
		<a href="#" id="to-top"><i class="icon-circle-arrow-up"></i> Top</a>

		<!--删除警示框-->
		<div class="modal small hide fade" id="deleteBox" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		    <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		        <h3 id="myModalLabel">警告框</h3>
		    </div>
		    <div class="modal-body">
		        <p class="error-text"><i class="icon-warning-sign modal-icon"></i>你确定要删除这个学生成绩么?</p>
		    </div>
		    <div class="modal-footer">
		        <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
		        <button class="btn btn-danger" id="submit" >删除</button>
		    </div>
		</div>
		<!--警示框END-->
	</div>
</div>
<?php include PATH_TPL."/tpl_sidebar.html" ?>